package com.hc.model.code02.test9;

/**
 * @version v1.0
 * @ClassName: CoffeeSimple
 * @Description: 咖啡简单工厂类
 * @Author: HC
 */
public class CoffeeSimple {

    public static Coffee createCoffee(String type) {
        Coffee coffee = null;
        if ("american".equals(type)) {
            coffee = new AmericanCoffee();
        } else if ("latte".equals(type)){
            coffee = new LatteCoffee();
        } else {
            throw new RuntimeException("没有该类型的咖啡！！");
        }

        return coffee;
    }
}
